import "../lib/js/jsencrypt.min.js";
import "../lib/node_modules/jquery/dist/jquery.js";
import "../config/base.js";
; (function ($) {
    "use strict"
    var _global;
    var Encrypt = function (opt) {
        return new T(opt);
    }
    class T {
        constructor(opt) {
            opt && (this.baseConfig = opt.baseConfig);
            this.jsEncrypt = new JSEncrypt();
            this.publicKey = this.baseConfig.publicKey;
            this.privateKey = this.baseConfig.privateKey;
            this.jsEncrypt.setPublicKey(this.publicKey);
            this.jsEncrypt.setPrivateKey(this.privateKey);
           
        }
        encrypt(text) {
            return this.jsEncrypt.encrypt(text).replace(/\+/g, "JIAHAO");
        }
        decrypt(text) {
            return this.jsEncrypt.decrypt(text.replace( /JIAHAO/g,"+"));
        }
    }

    //将插件对象暴露给全局对象
    _global = (function () { return this || (0, eval)('this'); }());
    if (typeof module !== "undefined" && module.exports) {
        module.exports = Encrypt;
    } else if (typeof define === "function" && define.amd) {
        define(function () { return Encrypt; });
    } else {
        !('Encrypt' in _global) && (_global.Encrypt = Encrypt);
    }
})(jQuery);
